<!DOCTYPE html>
<html>
    <head>
        <!--<link rel="stylesheet" href="/zx2/skin01/zx_tuijian.css">
    <link rel="stylesheet" href="/zx2/skin01/zx_kuaixun.css">
    <link rel="stylesheet" href="./css/home_new_index_reform6.css">-->
        <link rel="stylesheet" href="/common/css/skeleton.css" />
        <style>
            .home_new-724-skt .time-skt {
                width: 0.3636rem;
                height: 0.2273rem;
            }
            .home_new-724-skt .palte-skt {
                width: 0.3636rem;
            }
            .home_new-724-skt .content-skt {
                margin-top: 0.1364rem;
                height: 0.5455rem;
            }
            .home_new-724-skt .bottom-skt {
                margin-top: 15px;
            }
            .home_new-724-skt .bottom-skt .share-skt {
                width: 0.2727rem;
            }
            .qes-content {
                padding-top: 0.15rem !important;
            }
        </style>
    </head>

    <body>
        <div class="ssgd">
            <!-- <div class="ssgd-tab clear">
           <div data-id="9" class="active">全部</div>
           <div data-id="10">大新闻</div>
           <div data-id="35">盘中异动</div>
           <div data-id="469">利好</div>
           <div data-id="723">公告</div>
       </div> -->

            <div class="box qes-content">
                <ul class="home_new-724-skt-wrap">
                    <li>
                        <div class="xfn-skeleton home_new-724-skt">
                            <div class="skt-row skt-row-between">
                                <div class="skt-ele time-skt"></div>
                            </div>
                            <div class="skt-ele content-skt"></div>
                            <div class="skt-row bottom-skt">
                                <div class="skt-ele skt-right share-skt"></div>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="xfn-skeleton home_new-724-skt">
                            <div class="skt-row skt-row-between">
                                <div class="skt-ele time-skt"></div>
                            </div>
                            <div class="skt-ele content-skt"></div>
                            <div class="skt-row bottom-skt">
                                <div class="skt-ele skt-right share-skt"></div>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="xfn-skeleton home_new-724-skt">
                            <div class="skt-row skt-row-between">
                                <div class="skt-ele time-skt"></div>
                            </div>
                            <div class="skt-ele content-skt"></div>
                            <div class="skt-row bottom-skt">
                                <div class="skt-ele skt-right share-skt"></div>
                            </div>
                        </div>
                    </li>
                </ul>
                <!--全部-->
                <ul class="all">
                    <!--<li class="list_item_text">
                    <span class="list_date">2019-04-18 星期四</span>
                    <span class="list_item_source">
                        来源：华尔街见闻
                    </span>
                </li>
                <li class="list_item" data-id="281656902">
                    <div class="list_item_hd">
                        <div class="hd_line_cn">
                            <em class="red_yd"></em>
                        </div>
                    </div>
                    <div class="list_item_bd">
                        <div class="hd_date">
                            <p class="date">15:29</p>
                            <span>#园林</span>
                            <span>#环保</span>
                        </div>
                        <p class="hd_title">京津翼城际铁路发展基金设立，总规模达10 达1000亿 <img src="./img/lh.png" alt="lh"></p>
                        <p class="one-line newstitle close">
                            4月18日，京津翼城际铁路投资有限公司与中国工商银行、中国农业银行等12家银行合作
                        </p>
                        <div class="list_item_bottom">
                            <p class="item_bottom clear">
                                <span class="left">兴发集团 +4.89%</span>
                                <span class="right">澄星股份 -0.89%</span>
                            </p>
                            <div class="share" data-time="05月29日 15:29" data-cont="研报【太平洋证券：一心堂<u><a href=/action:12051/?stockcode=002727>002727</a></u>:资金充裕,为规模扩张储备充足弹药】一心堂：资金充裕，为规模扩张储备充足弹药公司拟发行的不超过12亿元短融券，承销方式为余额包销，连同拟发行的不超过4亿中期票据，资金主要用于补充流动资金，提高公司收益。"><i></i></div>
                        </div>

                    </div>
                </li>
                <li class="list_item" data-id="281656902">
                    <div class="list_item_hd">
                        <div class="hd_line_cn">
                            <em class="red_yd"></em>
                        </div>
                    </div>
                    <div class="list_item_bd">
                        <div class="hd_date">
                            <p class="date">15:29</p>
                            <span>#稀土磁材</span>
                        </div>
                        <p class="hd_title big_news">我是大新闻真的我是大新闻真的我是大我是我是大新闻真的我是大新闻真的我是大我是我是大新闻真的我是大新闻真的我是大我是我是大新闻真的我是大新闻真的我是大我是我是大新闻真的我是大新闻真的我是大我是</p>
                        <div class="list_item_bottom">
                            <p class="item_bottom clear">
                                <span class="left">兴发集团 +4.89%</span>
                                <span class="right">澄星股份 -0.89%</span>
                            </p>
                            <div class="share" data-time="05月29日 15:29" data-cont="研报【太平洋证券：一心堂<u><a href=/action:12051/?stockcode=002727>002727</a></u>:资金充裕,为规模扩张储备充足弹药】一心堂：资金充裕，为规模扩张储备充足弹药公司拟发行的不超过12亿元短融券，承销方式为余额包销，连同拟发行的不超过4亿中期票据，资金主要用于补充流动资金，提高公司收益。"><i></i></div>
                        </div>

                    </div>
                </li>-->
                </ul>
            </div>
        </div>
    </body>
    <script src="/zx2/js/html2canvas.min.js"></script>
    <script src="/home_new/js/crypto-js.js"></script>
    <script src="/home_new/js/info.js"></script>
    <script>
        var kx_list = {};
        QESEvent();
        function QESEvent() {
            $('.ssgd').delegate('.newstitle', 'click', function () {
                $(this).toggleClass('close');
            });
            $('.ssgd').delegate('.share', 'click', function (event) {
                event.stopPropagation();
                var time = $(this).attr('data-time');
                var cont = $(this).attr('data-cont');

                var bq = $(this).attr('data-bq');
                var bt = $(this).attr('data-bt');

                $('.captime').html(time);
                $('.capcentertitle').html(bt);
                $('.capcenter .capcontent').html(cont);
                html2canvas(document.querySelector('#capture')).then(function (canvas) {
                    var imgUri = canvas.toDataURL('image/png', 1); // 获取生成的图片的url
                    var contentImg = imgUri.split('base64,')[1];
                    T.fn.changeurl('http://action:10055/?contenttype=1&&image=' + encodeURIComponent(contentImg));
                });
            });

            //跳转个股行情页
            $('.ssgd').delegate('.list_item_bottom span', 'click', function (event) {
                T.stopBubble();
                /*console.log($(this).find(".code").attr('data-id'))*/
                var stockcode = $(this).find('.code').attr('data-id');
                var stocktype = $(this).find('.code').attr('data-market');
                onJsOverrideUrlLoading('http://action:12051/?stockcode=' + stockcode + '&&stocktype=' + stocktype);
            });
            //跳转个股行情页
            $('.ssgd').delegate('.hd_date span', 'click', function (event) {
                T.stopBubble();
                console.log($(this).attr('data-id'));
                var sId = $(this).attr('data-id');
                if (!sId) {
                    return;
                }
                var obj = {
                    url: '/hq/zt_xq.html?id=' + sId + '',
                };
                var oSend = { url: obj.url };
                TZT.fn.action10061(oSend);
            });
        }

        oVal.qesPage = { num: 1, size: 20 };
        upCallback(oVal.qesPage);
        function upCallback(page) {
            //上拉加载的回调
            var dates = [];
            $('.all .list_item_text .list_date').each(function () {
                dates.push($(this).text());
            });
            queryNews(page.num, page.size)
                .then(function (res) {
                    console.log(res);
                    var _rq = '',
                        _dateWeek = '',
                        titleDate = '',
                        sHtml = '';
                    res.data.records.forEach(function (record) {
                        var createTime = new Date(record.ctime * 1000);
                        var timehtml = createTime.format('hh:mm');
                        _rq = createTime.format('yyyy-MM-dd');
                        _dateWeek = _rq + ' ' + isWeek(_rq);
                        if (dates.indexOf(_dateWeek) < 0) {
                            dates.push(_dateWeek);
                            sHtml +=
                                '<li class="list_item_text">\n' +
                                '         <span class="list_date">' +
                                _dateWeek +
                                '</span>\n' +
                                '         <span class="list_item_source">\n' +
                                '             来源：财联社资讯\n' +
                                '         </span>\n' +
                                '     </li>';
                        } else {
                            //sHtml += "";
                        }

                        // 生成标签
                        var bqhtml = '';
                        if (record.plates) {
                            record.plates.forEach(function (plate) {
                                bqhtml += '<span data-id=' + plate.id + '>#' + plate.name + '</span>';
                            });
                        }

                        var gphtml = '';
                        record.stocks.slice(0, 2).forEach(function (stock) {
                            gphtml +=
                                '<span class="' +
                                (stock.isUp ? 'zf' : 'df') +
                                '"><i class="code ' +
                                (stock.isUp ? 'zf' : 'df') +
                                '" data-market="' +
                                stock.market +
                                '" data-id="' +
                                stock.stockCode +
                                '">' +
                                stock.stockName +
                                '</i><i class="range">' +
                                stock.signValue +
                                '</i></span>';
                        });

                        //分享时间
                        var share_time = kxDate(createTime.format('yyyy-MM-dd hh:mm:ss'));

                        sHtml +=
                            '<li class="list_item" data-id="">\n' +
                            '                    <div class="list_item_hd">\n' +
                            '                        <div class="hd_line_cn">\n' +
                            '                            <em class="red_yd"></em>\n' +
                            '                        </div>\n' +
                            '                    </div>\n' +
                            '                    <div class="list_item_bd">\n' +
                            '                        <div class="hd_date"><p class="date">' +
                            timehtml +
                            '</p>' +
                            bqhtml +
                            '</div>\n' +
                            '                        <p class="hd_title" data-id="' +
                            record.id +
                            '">' +
                            '' +
                            ' <img class="none" src="/zx2/img/lh.png" alt="lh"></p>\n' +
                            '                        <p class="one-line newstitle close">\n' +
                            '                            ' +
                            record.content +
                            '\n' +
                            '                        </p>\n' +
                            '                        <div class="list_item_bottom">\n' +
                            '                            <p class="item_bottom clear">' +
                            gphtml +
                            '</p>\n' +
                            '                            <div class="share" data-bt="" data-bq="' +
                            bqhtml +
                            '" data-time="' +
                            share_time +
                            '" data-cont="' +
                            record.content +
                            '"><i></i></div>\n' +
                            '                        </div>\n' +
                            '                    </div>\n' +
                            '                </li>';
                    });
                    $('.home_new-724-skt-wrap').hide();
                    if (page.num == 1) {
                        $('.qes-content ul.all').html(sHtml);
                        $(document).scrollTop(0);
                    } else {
                        $('.qes-content ul.all').append(sHtml);
                    }
                    oVal.loadQESFlag = true;
                })
                .catch(function (e) {
                    $('.qes-content ul').append('没有数据');
                });
        }
        function formatDate(date) {
            var num = getDays(date.substr(0, 4) + date.substr(5, 2) + date.substr(8, 2));
            if (num == 0) {
                //今日
                return '今日 ' + date.substr(5, 5);
            } else if (num == 1) {
                //昨日
                return '昨日 ' + date.substr(5, 5);
            } else {
                return date.substr(5, 5);
            }
        }
        function getDays(data) {
            var date = data.toString();
            var year = date.substring(0, 4);
            var month = date.substring(4, 6);
            var day = date.substring(6, 8);
            var d1 = new Date(year + '/' + month + '/' + day);
            var dd = new Date();
            var y = dd.getFullYear();
            var m = dd.getMonth() + 1;
            var d = dd.getDate();
            var d2 = new Date(y + '/' + m + '/' + d);
            var iday = parseInt(d2 - d1) / 1000 / 60 / 60 / 24;
            return iday;
        }
        function kxDate(data) {
            //快讯分享时间转换
            var date = data.toString().split(' ');
            var day = date[0].substring(5).replace('-', '月') + '日';
            var time = date[1].substring(0, 5);
            return day + ' ' + time;
        }

        /*获取股票涨跌幅*/
        function getStock(codeArr) {
            var codeGrid = [];
            for (var i = 0; i < codeArr.length; i++) {
                codeGrid.push(codeArr[i].code);
            }
            $.getData({
                oSendData: {
                    Action: 60,
                    grid: codeGrid.join(','),
                    NewMarketNo: 1,
                    ReqlinkType: 0,
                    maxCount: 100,
                    AccountIndex: 0,
                    StockIndex: 1,
                },
                copyIsArray: false,
                isload: false,
                fnSuccess: function (data) {
                    //console.log("股票：",data.GRID0[1].split("|")[data.UPDOWNPINDEX]);

                    if (data.GRID0 && data.GRID0.length > 1) {
                        for (var i = 0; i < codeArr.length; i++) {
                            for (var j = 1; j < data.GRID0.length; j++) {
                                var aGrid = data.GRID0[j].split('|');
                                var _zdf = aGrid[data.UPDOWNPINDEX],
                                    stockcode = aGrid[data.STOCKCODEINDEX],
                                    zdClass = '';
                                if (Number(_zdf.replace('%', '')) > 0) {
                                    //判断股票是涨幅还是跌幅
                                    zdClass = 'zf';
                                    _zdf = '+' + _zdf;
                                } else {
                                    zdClass = 'df';
                                }
                                if (codeArr[i].code == stockcode) {
                                    codeArr[i].dom.parent().addClass(zdClass);
                                    codeArr[i].dom.html(_zdf);
                                }
                            }
                        }
                    }
                },
                oConfig: function (error) {
                    console.log(error);
                },
            });
        }
        /**/
        function isToday(str) {
            return new Date().toDateString() === new Date(str.replace(/-/g, '/')).toDateString(); //ios中时间转换new Date()不兼容横杆'-'问题，转为斜杠‘/’
        }
        /*日期转换成星期*/
        function isWeek(str) {
            var array = new Array();
            var date = str; //日期为输入日期，格式为 2016-8-10
            array = date.split('-');
            var ndate = new Date(array[0], parseInt(array[1] - 1), array[2]);
            var weekArray = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
            //var weekDay = weekArray[ndate.getDay()];
            return weekArray[ndate.getDay()];
        }
        /*处理格林尼治时间*/
        function setDateTime(fnTime) {
            var x = fnTime; // 取得时间"2017-07-08 13:00:00"
            if (!T.judge('ISIOS')) {
                x = fnTime;
            } else {
                //处理下，ios转换有问题
                x = fnTime.replace(/-/g, '/');
            }
            var time = new Date(x);
            var timeNum = 8; //小时数
            time.setHours(time.getHours() + timeNum);
            return time;
        }
        Date.prototype.format = function (fmt) {
            var o = {
                'M+': this.getMonth() + 1, //月份
                'd+': this.getDate(), //日
                'h+': this.getHours(), //小时
                'm+': this.getMinutes(), //分
                's+': this.getSeconds(), //秒
                'q+': Math.floor((this.getMonth() + 3) / 3), //季度
                S: this.getMilliseconds(), //毫秒
            };
            if (/(y+)/.test(fmt)) {
                fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
            }
            for (var k in o) {
                if (new RegExp('(' + k + ')').test(fmt)) {
                    fmt = fmt.replace(
                        RegExp.$1,
                        RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
                    );
                }
            }
            return fmt;
        };

        oVal.loadQESFlag = true;
        $('.page-wrapper')
            .off('scroll')
            .scroll(function () {
                //控制首页顶部显示，与客户端交互
                reqrolloffset();
                var scrollTop = $('.page-wrapper').scrollTop();
                var headerHeight = $('.header').height();
                var scrollHeight = $('.more-page').height() + headerHeight; //总高度
                var screenHeight = $('body').height(); //屏幕高度
                var appHeight = $('.app-header').height();
                if (commonFunction.compareVersion(oVal.currVersion, oVal.limitedVersion)) {
                    appHeight = 0;
                }
                if (scrollTop >= headerHeight - appHeight) {
                    $('.nav-group').addClass('nav-group-fixed');
                    if (appHeight != '0') {
                        $('.nav-group').css('top', appHeight + 'px');
                        $('.title-bar').css({
                            display: 'block',
                            position: 'fixed',
                            height: appHeight + 'px',
                            width: '100%',
                            top: '0px',
                            'z-index': '2',
                        });
                    }
                } else {
                    $('.nav-group').removeClass('nav-group-fixed');
                    if (appHeight != '0') {
                        $('.nav-group').css('top', 'inherit');
                        $('.title-bar').css({ display: 'none', position: 'relative', height: '0px' });
                    }
                }
                if (scrollTop + screenHeight * 2 >= scrollHeight) {
                    if (oVal.loadQESFlag) {
                        console.log('加载数据');
                        oVal.loadQESFlag = false;
                        oVal.qesPage.num++;
                        upCallback(oVal.qesPage);
                    }
                }
            });
    </script>
</html>
